package dao;

import hashing.AeSimpleSHA1;

import java.util.List;

import model.LoginDetails;
import model.RegistrationDetails;
import model.User;
import model.Vote;

public class Test {

	public static void main(String[] args) throws Exception {
		UserDAO userDAO = new UserDAO();
		List<Vote> votes = userDAO.latestVotes();
		System.out.println(votes.get(1).getVoterName() + " voted for "
				+ votes.get(1).getEncryptedVote() + " @ "
				+ votes.get(1).getVoteTime());
		// System.out.println(userDAO.getUser("mohamed.khamis1@student.guc.edu.eg",
		// "test")!=null);
		RegistrationDetails registrationDetails = new RegistrationDetails();
		registrationDetails.setEmail("karim.el-sayed@student.guc.edu.eg");
		registrationDetails.setFullName("Karim Hany Fawzy El-Sayed");
		registrationDetails.setPassword("kix");
		System.out.println("name is: "
				+ userDAO.getUserByEmail("mohamed.khamis@student.guc.edu.eg")
						.getName());
		LoginDetails loginDetails = new LoginDetails();
		loginDetails.setEmail("mohamed.khamis@student.guc.edu.eg");
		loginDetails.setPassword("test");
		User khamiso = userDAO.getUserByLoginDetails(loginDetails);

		khamiso.setName("Mohamed Mohsen Khamis");

		userDAO.commitUser(khamiso);

		// userDAO.register(registrationDetails);
		// System.out.println(AeSimpleSHA1.SHA1("kix").equals("6a683b123ff21c6a4d4420cae5002cc016b81585"));
		// System.out.println(AeSimpleSHA1.SHA1("test").equals("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"));
		// System.out.println(userDAO.isRegistered(registrationDetails));

	}
}